package com.leave.mos.controller;

import com.leave.mos.entity.User;
import com.leave.mos.service.MongodbInsertService;
import com.leave.mos.service.MongodbSaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

/**
 * @ClassName MongodbSaveController
 * @Description TODO
 * @Author lh
 * @Date 2021/7/7 17:42
 * @Version 1.0
 **/

@RestController
@RequestMapping("insert")
public class MongodbInsertController {

    @Autowired
    private MongodbInsertService mongodbInsertService;

    @RequestMapping("/insert")
    User insert(User user){
        return mongodbInsertService.insert(user);
    }


    @RequestMapping("/insertTable")
    User insertTable(User user){
        return mongodbInsertService.insertTable(user);
    }

    @RequestMapping("/insertClass")
    User insertClass(User user){
        return mongodbInsertService.insertClass(user);
    }

    @RequestMapping("/insertBatchClass")
    Collection<User> insertBatchClass(User users){
        return mongodbInsertService.insertBatchClass(users);
    }

    @RequestMapping("/insertBatchTable")
    Collection<User> insertBatchTable(User users){
        return mongodbInsertService.insertBatchTable(users);
    }

    @RequestMapping("/insertAll")
    Collection<User> insertAll(User users){
        return mongodbInsertService.insertAll(users);
    }

}
